COMPILER = g++
CCFLAGS = -g 
AR = ar
INCLUDES = -I../includes/
OBJECTS = getabsmod.o client.o history.o sharedseg.o strfunc.o linkedlist.o 
LIBNAME = libtagcommon.a

library: ${OBJECTS}
	${AR} rvu ${LIBNAME} ${OBJECTS}
	ranlib ${LIBNAME}

getabsmod.o : ../includes/getabsmod.h getabsmod.cpp 
	${COMPILER} ${CCFLAGS} ${INCLUDES} -c getabsmod.cpp

history.o : ../includes/history.h history.cpp 
	${COMPILER} ${CCFLAGS} ${INCLUDES} -c history.cpp

linkedlist.o : linkedlist.cpp ../includes/linkedlist.h 
	${COMPILER} ${CCFLAGS} ${INCLUDES} -c linkedlist.cpp 

client.o : ../includes/nPatriciaTrie.h client.cpp ../includes/linkedlist.h
	${COMPILER} ${CCFLAGS} ${INCLUDES} -c client.cpp 

strfunc.o : ../includes/strfunc.h strfunc.cpp
	${COMPILER} ${CCFLAGS} ${INCLUDES} -c strfunc.cpp 

sharedseg.o : ../includes/sharedseg.h sharedseg.cpp
	${COMPILER} ${CCFLAGS} ${INCLUDES} -c sharedseg.cpp 

clean:	
	rm -rf *.o libtagcommon.a testabs testhistory testlist testpat
	rm -rf *~

fresh:  clean library

testabs: testabs.cpp library
	${COMPILER} ${CCFLAGS} ${INCLUDES} -L. -ltagcommon testabs.cpp getabsmod.o -o testabs

testhistory: testhistory.cpp library
	${COMPILER} ${CCFLAGS} ${INCLUDES} -L. -ltagcommon testhistory.cpp history.o linkedlist.o -o testhistory

testlist: testlist.cpp library
	${COMPILER} ${CCFLAGS} ${INCLUDES} -L. -ltagcommon linkedlist.o testlist.cpp -o testlist

testpat: testpat.cpp library
	${COMPILER} ${CCFLAGS} ${INCLUDES} -L. -ltagcommon linkedlist.o testpat.cpp -o testpat

test: testlist testabs testhistory testpat

all : library test

fresh:  clean library
